<template>
  <view class="tabbar">
    <view class="tab-item">
      <image src="https://fuqiaohui.oss-cn-chengdu.aliyuncs.com/user/set.png" mode="" class="img"></image>
      <view class="set">建设中</view>
    </view>
    <view class="active center" @click="goCode">
      <image src="https://fuqiaohui.oss-cn-chengdu.aliyuncs.com/user/code.png" mode="" class="active-img"></image>
    </view>
    <view class="tab-item">
      <image src="https://fuqiaohui.oss-cn-chengdu.aliyuncs.com/user/my.png" mode="" class="img"></image>
      <view class="my">我的</view>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    vipTime: {
      // 内容区域是否通栏
      type: String,
      default: ""
    }
  },
  name: "tabbar",
  data() {
    return {
      token: uni.getStorageSync("token") || ""
    }
  },
  methods: {
    goCode() {
      if (!this.token)
        return uni.showModal({
          title: "暂未登录",
          content: "是否现在去登录",
          success: res => {
            if (res.confirm) {
              uni.navigateTo({
                url: "/pages/getInfo/getInfo"
              })
            } else if (res.cancel) {
              console.log("用户点击取消")
            }
          }
        })
      if (!this.vipTime)
        return uni.navigateTo({
          url: "/pages/vip/vip"
        })
      // return uni.showModal({
      //   title: "您还不是会员",
      //   content: "是否现在去购买",
      //   success: res => {
      //     if (res.confirm) {
      //       uni.navigateTo({
      //         url: "/pages/vip/vip"
      //       })
      //     } else if (res.cancel) {
      //       console.log("用户点击取消")
      //     }
      //   }
      // })
      uni.navigateTo({
        url: "/pages/code/code"
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 140rpx;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 110rpx;
}

.tab-item {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.active {
  margin-bottom: 80rpx;
}

.active-img {
  width: 130rpx;
  height: 130rpx;
}

.img {
  width: 40rpx;
  height: 40rpx;
  margin-bottom: 6rpx;
}

.set {
  font-size: 26rpx;
  color: #b9b9b9;
}

.my {
  font-size: 26rpx;
  color: #114f9e;
}
</style>
